package com.fs.ibox.service.impl;


import com.fs.ibox.dao.OrdersDao;
import com.fs.ibox.pojo.Orders;
import com.fs.ibox.service.OrdersService;
import com.fs.ibox.util.BeanFactory;
import com.fs.ibox.vo.MarketCollection;

import java.util.Date;
import java.util.List;

public class OrdersServiceimpl implements OrdersService {

    @Override
    public void addOrders(MarketCollection col, String user, Date odate) {
        Orders orders = new Orders();
        orders.setOrdersId(col.getUsername() + odate.getMonth() +odate.getDay());
        orders.setUsernameSell(col.getUsername());
        orders.setUsernameBy(user);
        orders.setOprice(col.getPrice());
        orders.setCname(col.getCname());
        orders.setCimg(col.getCimg());
        orders.setOrdertime(odate);
        OrdersDao bean = BeanFactory.createBean(OrdersDao.class);
        bean.addOrdersh(orders);
    }
    OrdersDao OrdersDao = BeanFactory.createBean(OrdersDao.class);
    @Override
    public void addOrders(Orders order) {
        OrdersDao.addOrders(order);
    }

    @Override
    public List<Orders> queryOrdersAll() {
        return OrdersDao.queryOrdersAll();
    }

    @Override
    public void delById(int id) {
        OrdersDao.delById(id);
    }
}
